#! /bin/sh

HOME=`pwd`
BUILD_PATH=${HOME}/build
BIN_PATH=${HOME}/bin

# build/bin 文件夹如果存在，就删除其内容
# 文件夹不存在， 就创建文件夹
cd $HOME
if [ -d build ]; then
    rm -rf build/*
else
    mkdir build
fi

if [ -d bin ]; then
    rm -rf bin/*
else
    mkdir bin
fi

# 构建项目
cd $BUILD_PATH
cmake ..
make

# 把动态库.so加入到/usr/lib64
cd $BIN_PATH
mv `ls` /usr/lib64

# 把线程池的头文件加入到/usr/include
cd $HOME
for header in `ls *.h`; do
    cp $header /usr/include
done


